addColumn() Method |
This method adds a new column to the XGrid. This allows for the expansion of the XGrid, dynamically, during runtime.
Syntax
xgridId.addColumn(id, ref, label, fieldType, dataType, misc1, misc2, bApplyPreference)
Parameters
Parameter | Description |
---|---|
String | Rrequired. Identifier of the column. |
ref | String; required. Refers to the XPath of the business element, with respect to the businessObject. See ref. |
label | String; required. Refers to the text that is displayed in the header of a column. Use "" for an empty label. |
fieldType | String. This is an optional parameter with the default value asinput. It sets the field type of the cells in the column; possible values areinput,output,checkbox,password,dropdown,textarea, andimage. |
dataType | String. This is an optional parameter with the default value asstring. It sets the data type of the cells in the column; possible values arestring,integer,float,double,decimal,amount,date,hexbinary,base64binary, andanyuri. |
misc1 | String; optional. Its usage depends on the fieldType as described in the following table: |
input | n/a |
output | n/a |
checkbox | Required. Refers to the true value of the bound data; often "1" or "true". |
password | n/a |
dropdown | Required. Refers to the ID the dropdown field. |
textarea | n/a |
image | Boolean. This is an optional parameter with the default value as "false". It indicates whether the image is to be displayed as a thumbnail. |
misc2 | String; optional. Its usage depends on the fieldType as describes in the following table: |
input | n/a |
output | n/a |
checkbox | Required. Refers to the false value of the bound data; often "0" or "false". |
password | n/a |
dropdown | n/a |
textarea | n/a |
image | Optional. String that denotes the size of icons in a Column. Possible values are:
|
bApplyPreferenceState |
Boolean; This is an optional parameter with the default value false. Denotes whether to apply preference or not. |
Return Value
No return value.
Example
The following example demonstrates the use of this method to add a column to the XGrid.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html onapplicationready="getData()"> <head> <title>AddColumn method</title> <script src="/cordys/wcp/application.js"></script> <script> function getData() { bdiEmployees.reset(); employeesGrid.bindData( bdiEmployees.data ); } function addColumn() { employeesGrid.addColumn( "inviteId", "invited", "Invite to Party", "checkbox", null, "For friends", "true", "false"); } </script> <script type="cordys/xml" id="details"> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body> <GetEmployeesObjects xmlns="http://schemas.cordys.com/DemoWebServices"> <fromEmployeeID>1</fromEmployeeID> <toEmployeeID>10</toEmployeeID> </GetEmployeesObjects> </SOAP:Body> </SOAP:Envelope> </script> </head> <body> <div cordysType="wcp.library.data.BusDataIsland" async="false" id="bdiEmployees" request="details.XMLDocument"> </div> <button onclick="addColumn()">Add Invite Option</button> <br /> <div style="width:100%;height:100%;overflow:hidden"> <div cordysType="wcp.library.ui.XGrid" id="employeesGrid" xpathRowData = ".//*[local-name()='data']/*[local-name()='GetEmployeesObjectsResponse']/*[local-name()='tuple']"; xpathBusinessObject = ".//*[local-name()='Employees']" style="width:600;height:150"> <div id="EmployeeID" ref=".//*[local-name()='EmployeeID']" dataType="integer">EmployeeID</div> <div id="FirstName" ref=".//*[local-name()='FirstName']">FirstName</div> <div id="LastName" ref=".//*[local-name()='LastName']">LastName</div> </div> </div> </body> </html>